<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" id="html">
    <head>
        <title></title>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <base href="<?= base_url(1); ?>" />
        <link type="text/css" href="css/main.css?v=<?= $config['version'] ?>" rel="stylesheet" />
        <script src="js/time.js?"></script>
    </head>
    <body>
        <?php include(VIEWPATH . 'common/main_header.php'); ?>
        <form action="" method="POST" id="rowForm">
            <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tablegrid tableedit">
            	<tr><td><?= translate('ACTIVITY_NAME') ?>:</td><td><input type='text' name="row[name]" id='name' value="<?= $row['name'] ?>"></td></tr>
                <tr><td><?= translate('STATE') ?>:</td><td>
                        <input type="radio" name="row[isOpen]" id="state" size="50" value=0 <?php if ($row['isOpen'] == 0) echo 'checked' ?> /><?= translate('CLOSE') ?>&nbsp;
                        <input type="radio" name="row[isOpen]" id="state" size="50" value=1 <?php if ($row['isOpen'] == 1) echo 'checked' ?> /><?= translate('OPEN') ?>&nbsp;
                    </td></tr>
                    
       <!--          <tr><td><?= translate('TYPE') ?>:</td><td>
                        <input type="radio" name="row[defaultstate]" id="defstate" size="50" value=0 <?php if ($row['defaultstate'] == 0) echo 'checked' ?> /><?= translate('OLD_ACTIVITY') ?>&nbsp;
                        <input type="radio" name="row[defaultstate]" id="defstate" size="50" value=1 <?php if ($row['defaultstate'] == 1) echo 'checked' ?> /><?= translate('NEW_ACTIVITY') ?>&nbsp;
                    </td></tr>
               
           
                <tr><td><?= translate('ACTIVITY_LEVEL') ?>:</td><td><input type="text" name="row[level]" id="level" size="25" value="<?= $row['level']?>"/></td></tr>
                <tr><td><?= translate('ACTIVITY_TIMES') ?>:</td><td><input type="text" name="row[times]" id="times" size="25" value="<?= $row['times']?>"/></td></tr>
        -->       
                <tr><td><?= translate('STARTTIME') ?>:</td><td><input type="text" name="row[startTime]" id="starttime" readonly size="25" value="<?= date("Y-m-d H:i:s", $row['startTime']) ?>" onclick="SelectDate(this,'yyyy-MM-dd hh:mm:ss',0,10)" showtime="true" /></td></tr>
                <tr><td><?= translate('ENDTIME') ?>:</td><td><input type="text" name="row[endTime]" id="endtime" readonly size="25" value="<?= date("Y-m-d H:i:s", $row['endTime']) ?>" onclick="SelectDate(this,'yyyy-MM-dd hh:mm:ss',0,10)" showtime="true" /></td></tr>
                <tr><td><?= translate('STATUS') ?>:</td><td>
                        <input type="radio" name="Operate" value=0 /> <?= translate('ALL_AREA') ?>&nbsp;
                        <input type="radio" name="Operate" value=1 checked /> <?= translate('SINGLE_AREA') ?>&nbsp;
                    </td></tr>
                <tr><td><?= translate('DESCRIBE') ?>:</td><td><textarea name="row[describe]" id="describe" rows='3' cols='25' ><?= $row['describe']?></textarea></td></tr>
            <!-- <tr><td><?= translate('RULES') ?>:</td><td><textarea name="row[rules]" id="rules" rows='2' cols='25' ><?= $row['rules']?></textarea></td></tr>
                <tr><td><?= translate('STRING_TIME') ?>:</td><td><textarea name="row[string_time]" id="string_time" rows='2' cols='25' ><?= $row['string_time']?></textarea></td></tr>  -->
                <tr><td><?= translate('ACTIVITY_ACTIVITYTIME_ISVER') ?>:</td><td><?= $isEver ?></td></tr>
                <tr><td><input type="submit" value="<?= translate('SUBMIT') ?>" id="submit"/> <input type="reset" value="<?= translate('RESET') ?>" id="reset"/></td></tr>
            </table>
        </form>
        <script type="text/javascript">
            SG.init("core.form", function() {
                $.formValidator.initConfig({formid: "#rowForm", submitonce: true});
                $("#starttime").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
                $("#endtime").formValidator({empty: false, onshow: '<?= translate('PLASE_SELECT') ?>'}).inputValidator({min: 1, onerrormin: '<?= translate('C_NOT_EMPTY') ?>'});
            });
//            $('document').ready(function() {
//                if ($(':radio[name="row[isOpen]"]:checked').val() === 0) {
//                    $('#starttime').attr("readonly", "readonly");
//                    $('#endtime').attr("readonly", "readonly");
//                } else {
//                    $('#starttime').attr("readonly", "");
//                    $('#endtime').attr("readonly", "");
//                }
//            });
//            $(':radio[name="row[isOpen]"]').change(function() {
//                if ($(':radio[name="row[isOpen]"]:checked').val() === 0) {
//                    $('#starttime').attr("readonly", "readonly");
//                    $('#endtime').attr("readonly", "readonly");
//                } else {
//                    $('#starttime').attr("readonly", "");
//                    $('#endtime').attr("readonly", "");
//                }
//            });
        </script>
    </body>
</html>